﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfRouteDetailList.aspx.cs" Inherits="msBsc.WebUi.ShpMana.wfRouteDetailList" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>路线_列表</title>
    <link href="/jqPlugin/jqTab/ui.tabs.css" rel="stylesheet" type="text/css" />
    <script src="/jqPlugin/jqTab/ui.tabs.js" type="text/javascript"></script>

    <link href="/jqPlugin/kindeditor/themes/default/default.css" type="text/css" rel="stylesheet" />
    <link href="/jqPlugin/SelectSimu/css/base.css" rel="stylesheet" />
    <script src='/??jqPlugin/kindeditor/kindeditor.js,jqPlugin/kindeditor/lang/zh_CN.js'
        type='text/javascript'></script>
    <style type="text/css">
        html, body {
            overflow: hidden;
            margin-left: 0px;
            margin-top: 0px;
            margin-right: 0px;
            margin-bottom: 0px;
        }

        .select .selectInput {
            width: 80px !important;
        }

        #outerInner, #province, #city {
            display: block;
            width: 80px !important;
            float: left;
            margin-right: 10px;
            z-index: 9999 !important;
        }
    </style>
   


</head>
<body>
    <form id="wfConstantHandle" method="post" runat="server">
        <asp:HiddenField ID="txtStatus" runat="server" Value="0" />
        <div style="width: 100%; text-align: left; margin: 0px 0px 0px 0px;">
            <div id="container2" style="width: 100%; margin-top: 3px; display: none;">
                <div id="fragment1">
                    <div id="divCondition" style="margin: 0px; border-style: solid; border-width: 1px; border-color: #C8D2E0;">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td class="label" width="70px">景点名称
                                </td>
                                <td align="right" width="110px">
                                    <asp:TextBox ID="routeName" runat="server" Width="110px" MaxLength="100"></asp:TextBox>
                                </td>
                                <td align="center">
                                    <input type="button" onclick="javascript: btnDo('mFinder'); return false;" value="查询(F)"
                                        id="btnFinder" accesskey="F" />
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id="bigbox2" style="margin: 0px; margin-top: 2px;">
                        <div id="gridbox1" style="border: 0px solid #cccccc; background-color: #f3f3f3; padding: 5px;">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>

     <script src="/jqPlugin/js/jBase.js"></script>
    <script src="/jqPlugin/js/jBPage.js"></script>
    <script src="/jqPlugin/js/laytpl.js"></script>
    <script src="/jqPlugin/SelectSimu/js/SelectSimu.js"></script>
    <!--end JS引用-->
    <script type="text/javascript">
        $(window).load(function () {

            //初始化步进式搜索框
            $('#container2').fadeIn("fast"); //初始化TAB页选择控件
            $('#container2 ul').tabs();
            mygrid1.render();
            mygrid1.readOnly = true;
            autogtResize("bigbox2", mygrid1);
            SetBtnEnable('btnEdit', 'btnSave,btnNotSave,btnConfirm,btnCancel');
        });

        function doTabChange(sStatus) {
            if (sStatus != $('#txtStatus').val()) {
                $('#txtStatus').val(sStatus); btnDo('mFinder');
            }
        };

        //视图 切换
        function viewItem(sid, reqType) {
            if (reqType == "md") {
                OpenDialog("/ShpMana/wfUpdateRouteBaseinfo.aspx?routeId=" + sid, null, null, "修改路线");
            }
            else if (reqType == "add") {
                OpenDialog("/ShpMana/wfAddRoute.aspx", null, null, "添加景点");
            }
            else if (reqType == "addInfo") {
                OpenDialog("/ShpMana/wfAddRouteDatail.aspx?routeid=" + sid, null, null, "添加路线详情");
            }

        };

        //绑定 删除状态
        var clopCheckBox = { "0": "否", "1": "是" };
        function clrdCheckBox(value, record, columnObj, grid, colNo, rowNo) {
            var options = clopCheckBox;
            var ret = options[value];
            if (ret == null) {
                ret = value;
            }
            return ret;
        };

        //要自定义显示，比如链接等字段如下buynow,在renderer函数中返回要显示的HTML编码字符
        var colsOption = [
            { id: 'ROUTE_DETAIL_ID', hidden: true },
           {
               id: 'DETAIL_INFO_PIC', header: "封面图片", width: 120,
               renderer: function (value, record, columnObj, grid, colNo, rowNo) {
                   if (record.DETAIL_INFO_PIC != "") {
                       return "<img src=" + record.DETAIL_INFO_PIC + " style='width:100px;height:100px;' />";
                   } else {
                       return "";
                   }
               }
           },
            { id: 'ROUTE_NME', header: "路名称", width: 150 },
            { id: 'DETAIL_INFO_NME', header: "景点名称", width: 100 },
        { id: 'DETAIL_BELONG_DAY', header: "所属天数", width: 130 },
        { id: 'DETAIL_IS_SHOW', header: "是否显示", width: 100, renderer: clrdCheckBox },
         {
             id: 'IS_DELETED', header: "显示/隐藏", width: 70, resizable: false, filterable: false, exportable: false, sortable: false, printable: false,
             renderer: function (value, record, columnObj, grid, colNo, rowNo) {
                 return "<a  href=\"javascript:void(0);return false;\" onclick=\"javascript:updateStatus('" + record.ROUTE_DETAIL_ID + "'," + record.DETAIL_IS_SHOW + ");return false;\" >" + (record.DETAIL_IS_SHOW == "1" ? "隐藏" : "显示") + "</a>";

             }
         },
             {
                 id: 'del', header: "删除", width: 70, resizable: false, filterable: false, exportable: false, sortable: false, printable: false,
                 renderer: function (value, record, columnObj, grid, colNo, rowNo) {
                     return "<a  href=\"javascript:void(0);return false;\" onclick=\"javascript:deleteDatail('" + record.ROUTE_DETAIL_ID + "');return false;\" target='_self'>删除</a>";
                 }
             }
        ];

        //以下为固定的代码
        var gridOption1 = getGtOp('myGrid1', colsOption, 'gridbox1', 'BANK_ID');
        var mygrid1 = new Sigma.Grid(gridOption1);

        //事件处理
        function btnDo(sEbtn) {
            GtGrid1Action = sEbtn;
            var opart = GetGtParam("myGrid1");
            if (sEbtn == "mFinder") {
                doFinderGt('myGrid1');
            }
            else if (sEbtn == "btnEdit") {
                opart.AddCell("sEditMode", "EDIT");
                ajaxComm(opart, null, null, 'divCondition'); //调用页面回调，并传入参数
            }
            else if (sEbtn == "btnSave") {
                doSaveGt('myGrid1');
            }
            else if (sEbtn == "btnConfirm" || sEbtn == "btnCancel") {
                var sidtem1 = GetGtSelectId('myGrid1');
                if (sidtem1) {
                    opart.AddCell("CHECK_ID", sidtem1);
                    ajaxComm(opart, null, null, 'divCondition'); //调用页面回调，并传入参数
                } else {
                    alert("请先选择记录！");
                }
            }
            else {
                ajaxComm(opart, null, null, 'divCondition'); //调用页面回调，并传入参数
            }
            GtGrid1Action = "";
        };
        var routeid = GetQueryStr("routeid");
        //参数绑定
        function GetGtParam(jqGridID) {
            var _jsParam = new jsonRow();

            if (jqGridID == "myGrid1") {
                if (routeid == "") { return; }

                GetFormJson("divCondition", _jsParam);
                _jsParam.AddCell("PPAGE", "wfRouteDetailList"); //这个地方是该页面的类名
                _jsParam.AddCell("gtGridID", "myGrid1");
                _jsParam.AddCell("routeid", routeid);
                _jsParam.AddCell("routeName", $("#routeName").val());

                _jsParam.AddCell("ACTION", GtGrid1Action);
                //这里可增加传入后台的参数
            }
            return _jsParam;
        };

        //是否启用
        function updateStatus(id, status) {
            status = status == "1" ? 0 : 1;
            if (!confirm("你确认要" + (status > 0 ? "显示" : "隐藏") + "\t该路线")) {
                return;
            }
            var opart = new jsonRow();
            opart.AddCell("datailid", id);
            opart.AddCell("status", status);
            opart.AddCell("ACTION", "upStatus");
            ajaxComm(opart);
        }
        //删除
        function deleteDatail(id) {

            if (!confirm("你确认要删除该路线")) {
                return;
            }
            var opart = new jsonRow();
            opart.AddCell("datailid", id);
            opart.AddCell("ACTION", "del");
            ajaxComm(opart);
        }

        //成功
        function success() {
            alert('操作成功');
            setTimeout(function () {
                location.href = location.href;
            }, 1000);
        }
        
    </script>
</body>
</html>
